/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import com.opensymphony.xwork2.ActionContext;
import java.util.Map;
import models.PageBO;
import myconfession.dto.page.Page;

/**
 *
 * @author Liem
 */
public class AddPageAction {

    private String pagename;
    private String description;
    private String fbPageId;
    private String hashtag;
    private String imageLink;

    public AddPageAction() {
    }

    public String execute() throws Exception {

        Map session = ActionContext.getContext().getSession();
        String username = (String) session.get("USER");
        if (username != null) {
            Page page = new Page();
            page.setPagename(pagename);
            page.setDescription(description);
            page.setFbPageId(fbPageId);
            page.setHashtag(hashtag);
            page.setIsActive(true);
            page.setImageLink(imageLink);
            PageBO.addPage(page, username);
        }
        return "success";
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getFbPageId() {
        return fbPageId;
    }

    public void setFbPageId(String fbPageId) {
        this.fbPageId = fbPageId;
    }

    public String getHashtag() {
        return hashtag;
    }

    public void setHashtag(String hashtag) {
        this.hashtag = hashtag;
    }

    public String getImageLink() {
        return imageLink;
    }

    public void setImageLink(String imageLink) {
        this.imageLink = imageLink;
    }

    public String getPagename() {
        return pagename;
    }

    public void setPagename(String pagename) {
        this.pagename = pagename;
    }
}
